package com.example.controller;


import com.baomidou.dynamic.datasource.annotation.DS;
import com.example.common.result.Result;
import com.example.entity.matirx.KeepRes;
import com.example.exception.SaveFailException;
import com.example.service.KeepResService;
import com.github.xiaoymin.knife4j.annotations.ApiSupport;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/keepres")
@DS("mes")
@Api(tags = "保养结果相关",position = 995)
public class KeepResController {
    @Autowired
    KeepResService keepResService;

    @PostMapping("/save")
    @ApiOperation("保养结果新增或更新接口")
    public Result newRes(@RequestBody KeepRes res) {
        boolean save = keepResService.saveOrUpdate(res);
        if (!save)throw new SaveFailException("保存保养结果失败！");
        return Result.success();
    }

}
